﻿Public Class Save_Type_Dialog

    Private Sub cbSource_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles cbSource.SelectionChanged

    End Sub

    Private Sub btnConvert_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnConvert.Click
        DialogResult = True
        Me.Close()
    End Sub
    Public Function GetFormatType() As String
        If Me.ShowDialog = True Then
            Return cbSource.SelectedItem
        End If
    End Function

    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        cbSource.Items.Add("NDS")
        Dim plgdir As String = IO.Path.Combine(Environment.CurrentDirectory, "plugins")
        If IO.Directory.Exists(plgdir) Then
            Dim types() As String = IO.Directory.GetDirectories(plgdir)
            For Each item In types
                Dim temp As String() = item.Replace("/", "\").Split("\")
                Dim add As String = temp(temp.Length - 1)
                If Not cbSource.Items.Contains(add) Then cbSource.Items.Add(add)
            Next
        End If
        cbSource.SelectedIndex = 0
        If cbSource.Items.Count = 1 Then
            DialogResult = True
            Me.Close()
        End If
    End Sub
End Class
